#pragma once
#include <string>

namespace bs
{
	class AniObject
	{
	public:
		AniObject();
		virtual ~AniObject();

		virtual void Start();
		virtual void Stop();
		virtual void Pause();
		virtual void Resume();
		virtual void Update(int elapsed, float speedFactor = 1.0f);
		virtual void Draw(HDC dc);

		void SetMovement(float vel, int _dx, int _dy);    // from current pos
		void SetMovement(float vel, int _sx, int _sy, int _dx, int _dy);

		void SetVisible(bool v) { this->visible = v; }
		void SetAutoStop(bool stop) { this->autoStop = stop; }
		void StopMove() { this->moveAble = false; }

		void SetPos(float _x, float _y) { this->x = _x; this->y = _y; }
//		void SetSize(int _w, int _h) { this->w = _w; this->h = _h; }
		void SetZOrder(int _z) { this->z = _z; }
		void SetName(const char* n) { this->name = n; }
		void SetType(int t) { this->type = t; }

		int GetX() const { return (int)this->x; }
		int GetY() const { return (int)this->y; }
		int GetWidth() const { return this->w; }
		int GetHeight() const { return this->h; }
		int GetZOrder() const { return this->z; }
		const std::string& GetName() const { return this->name; }
		int GetType() const { return this->type; }

		bool IsPlaying() { return this->playing; }

		bool operator >= (AniObject& other)
		{
			return this->z >= other.z;
		}

		bool operator < (AniObject& other)
		{
			return !(*this >= other);
		}

	protected:
		void StartMovement();
		void Move(float speedFactor);

	protected:
		float x, y;
		int w, h;
		int z;
		std::string name;
		int type;

		bool playing;
		bool paused;

		bool visible;
		bool moveAble;
		bool autoStop;

		float vx, vy;
		int sx, sy;
		int dx, dy;
	};

}
